﻿@model BJG_Machining
@{
    Layout = "_LayoutMobile";
    ViewBag.Title = "查看加工订单";
}
@section header {
    <style>
        .van-uploader__upload{
        display:none;
        }
    </style>
}
<van-nav-bar title="加工订单"
             :fixed="true"
             left-arrow
             @@click-left="goBack"
             @@click-right="goHome">
    <van-icon name="edit" slot="right" size="24" />
</van-nav-bar>
<van-cell-group>
    <van-cell title="布行名" :value="model.PartnerName||''"></van-cell>
    <van-cell title="布行客户名" :value="model.PartnerContactMan||''"></van-cell>
    <van-cell title="送货人" :value="model.DeliveryMan||''"></van-cell>
    <van-cell title="送货日期" :value="model.DeliveryDate||''"></van-cell>
    <section class="van-doc-demo-block">
        <h2 class="van-doc-demo-block__title">送货单</h2>
        <van-uploader v-model="model.SHDs" :deletable="false" :disabled="true"></van-uploader>
    </section>
    <van-cell title="加工类型" :value="model.MachiningTypeText||''"></van-cell>
    <van-cell title="卷数" :value="model.Rolls"></van-cell>
    <van-cell title="米数" :value="model.Meters"></van-cell>
    <van-cell title="单价" :value="model.Price"></van-cell>
    <van-cell title="总价" :value="model.Total"></van-cell>
    <section class="van-doc-demo-block">
        <h2 class="van-doc-demo-block__title">当期账单</h2>
        <van-uploader v-model="model.DQZDs" :deletable="false" :disabled="true"></van-uploader>
    </section>
</van-cell-group>
@section footer {
    <script type="text/javascript">
        var modelJson=@(Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model, new Newtonsoft.Json.JsonSerializerSettings()
                {
                    DateFormatString = "yyyy-MM-dd HH:mm:ss"
                })))
        var modelData = $.extend(modelJson, {});
        var pageApp = new Vue({
             el: '#app',
                data: {
                    active:'machining',
                    model:modelData,
                },
                methods: {
                    goBack(){
                        window.location.href = '@(Url.Action("MobileList", "Machining"))';
                    },
                    goHome(){
                        window.location.href = '@(Url.Action("MobileEdit", "Machining"))/' + modelData.ID + '?nc=' + new Date().getTime();
                    },
                },
                filters: {
                    formatDate: function (val) {
                        return utils.formatDate(val, 'yyyy-MM-dd');
                    },
                },
        });
        $(function () {
            if(!isMobile())
            {
                    window.location.href = '@(Url.Action("ViewDetail", "Machining"))/' + modelData.ID + '?nc=' + new Date().getTime();
            }
        });

        function isMobile() {
          const regExp = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
          return regExp.test(navigator.userAgent);
        }
    </script>
}